import request from "@/utils/request";

/**
 * 获取病历字段列表
 * @param {Object} params 查询参数
 * @returns {Promise} 返回病历字段列表数据
 */
export function getMedicalFieldListByConditionApi(params) {
  return request({
    url: "/config/medicalField/getMedicalFieldListByCondition",
    method: "get",
    params,
  });
}

/**
 * 获取病历字段树形结构
 * @param {Object} params 查询参数
 * @returns {Promise} 返回病历字段树形结构数据
 */
export function getMedicalFieldTreeApi(params) {
  return request({
    url: "/config/medicalField/getMedicalFieldTree",
    method: "get",
    params,
  });
}

/**
 * 查询病历字段支持树
 * @param {Object} params 查询参数 - fieldId: 病历字段ID
 * @returns {Promise} 返回病历字段支持值树形结构数据
 */
export function getFieldSupportTreeApi(params) {
  return request({
    url: "/config/medicalField/getFieldSupportTree",
    method: "get",
    params,
  });
}

/**
 * 添加病历字段
 * @param {Object} data 病历字段信息
 * @returns {Promise} 返回添加结果
 */
export function addMedicalFieldApi(data) {
  return request({
    url: "/config/medicalField/addMedicalField",
    method: "post",
    data,
  });
}

/**
 * 更新病历字段
 * @param {Object} data 病历字段信息
 * @returns {Promise} 返回更新结果
 */
export function updateMedicalFieldApi(data) {
  return request({
    url: "/config/medicalField/updateMedicalField",
    method: "post",
    data,
  });
}

/**
 * 删除病历字段
 * @param {Object} data 删除参数
 * @returns {Promise} 返回删除结果
 */
export function deleteMedicalFieldApi(data) {
  return request({
    url: "/config/medicalField/deleteMedicalField",
    method: "post",
    data,
  });
}

/**
 * 添加病历字段支持
 * @param {Object} data 支持值信息
 * @returns {Promise} 返回添加结果
 */
export function addFieldSupportApi(data) {
  return request({
    url: "/config/medicalField/addFieldSupport",
    method: "post",
    data,
  });
}

/**
 * 修改病历字段支持
 * @param {Object} data 支持值信息
 * @returns {Promise} 返回更新结果
 */
export function updateFieldSupportApi(data) {
  return request({
    url: "/config/medicalField/updateFieldSupport",
    method: "post",
    data,
  });
}

/**
 * 删除病历字段支持
 * @param {Object} data 删除参数 - id: 取值ID
 * @returns {Promise} 返回删除结果
 */
export function deleteFieldSupportApi(data) {
  return request({
    url: "/config/medicalField/deleteFieldSupport",
    method: "post",
    data,
  });
} 